<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const user = {
        username: "jack",
        age: 20,
      };
      Object.defineProperty(user, "username", {
        // Object.defineProperty(user, "uname", {
        value: "lili",
        writable: false,
        configurable: false,
        enumerable: false,
      });

      user.username = "tom";
      delete user.username;
      for (let i in user) {
        console.log(user[i]);
      }
      // 写 遍历 删除
      console.log(Object.getOwnPropertyDescriptor(user, "username"));

      console.log(user);
    </script>
  </body>
</html>
